package com.dxq.basic_ui_library.manager;

import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.util.Log;

/**
 * @author zsh
 * @date 2020/3/25.
 * @功能 重写RecyclerView LinearLayoutManager部分bug
 */

public class RecyclerViewLinearLayoutManager extends LinearLayoutManager {

    public RecyclerViewLinearLayoutManager(Context context) {
        super(context);
    }

    public RecyclerViewLinearLayoutManager(Context context, int orientation, boolean reverseLayout) {
        super(context, orientation, reverseLayout);
    }

    public RecyclerViewLinearLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    @Override
    public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
        try {
            //try catch一下，捕获异常
            super.onLayoutChildren(recycler, state);
        } catch (IndexOutOfBoundsException e) {
            e.printStackTrace();
            Log.e("LinearLayoutManager", e.getMessage());
        }
    }

}
